<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //ES6允许按照一定模式从数组和对象中提取值，对变量进行赋值，这就叫做解构赋值

        //1、数组的解构赋值
        // let arr = ["刘能","赵四","宋晓","王小宝"]
        // let  [liu,zhao,song,wang] = arr;  //解构赋值
        // console.log(liu); //刘能

        //2、对象的解构赋值
        //打印对象的属性
        let obj ={
            name:'小明',
            age:20,
            say:function(){
                console.log("我能跑");
            }
        }

        let {name,age,say} = obj;
        console.log(age);
        //直接调用方法就行，不用一次次的写对象去调用
        say()

        

    </script>
</body>
</html>